package com.learn.xxl.job;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

@SpringBootTest
public class SpringBootXxlJobApplicationTest {

    @Test
    public void jobInfoTest() {
        List<XxlJobInfo> jobInfoList = new ArrayList<>();
        jobInfoList.add(new XxlJobInfo("handler1"));
        jobInfoList.add(new XxlJobInfo("handler2"));

        String targetHandler = "handler2";
        Optional<XxlJobInfo> first = jobInfoList.stream()
                .filter(jobInfo -> jobInfo.getExecutorHandler().equals(targetHandler))
                .findFirst();

        if (first.isPresent()) {
            XxlJobInfo jobInfo = first.get();
            System.out.println("找到了匹配的 XxlJobInfo 实例，执行器处理器名称为: " + jobInfo.getExecutorHandler());
        } else {
            System.out.println("没有找到匹配的 XxlJobInfo 实例。");
        }
    }



}